package com.nineclock.doc.controller;

import com.nineclock.common.entity.Result;
import com.nineclock.doc.DocumentControllerApi;
import com.nineclock.doc.dto.DocumentDto;
import com.nineclock.doc.service.DocumentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/document")
public class DocumentController implements DocumentControllerApi {
    @Autowired
    private DocumentService documentService;

    /**
     * 查询当前目录下的文件夹及文件
     * @param parentFoldId
     * @param keyword
     * @return
     */
    @Override
    @GetMapping("/listFolderAndFile")
    public Result<DocumentDto> queryFileAndFolder(String parentFoldId, String keyword) {
        DocumentDto documentDto = documentService.queryFileAndFolder(parentFoldId, keyword);
        return Result.success(documentDto);
    }
}
